A port of Marco Piovanelli's TextEdit Replacement WASTE to C by Dan Crevier
July 24, 1994
Introduction
WASTE is a replacement written by Marco Piovanelli which is World Script aware, and supports more than 32K of text. It is available at ghost.dsi.unimi.it in pub2/papers/piovanel/. It was written in Pascal and contains a library which can be used with a variety of compilers.
I converted WASTE from pascal to C so that a PPC native version could be compiled. My goal was to make it as similar to the original pascal version as possible. The C source is almost exactly the same as the pascal source. This means that when upgrades are made to WASTE, it should be painless to make the same upgrades to the C version, and also, programs that now use the WASTE library. The downside of this is that the C code could have been made slightly better if written differently.
Using C WASTE
It is simple to convert any project that now uses WASTE to use the C version. It is simply a matter of using the new version of WASTE.h (see below for difference in WASTE.h), and adding all of the C files to the project. If you are using any undocumented routines in WASTE, you might have to remove the word pascal from their prototypes.
The files must be compiled as C, not C++, so if you are using CodeWarrior, make sure you have not turned on the "Activate C++" option. This option makes it so that .c, .cp, and .cpp files all get compiled as C++. With the option off, .c gets compiled as C, and .cp and .cpp get compiled as C++.
The header file WASTEIntf.h should not be used in your source files. It has all of the declarations for the internal workings of WASTE, which are subject to change in future versions. You should continue to only include WASTE.h.
Differences from WASTE
There was only one modification I made to the WASTE source. That was to make checks of WEIsActive(hWE) at the beginning of WEActivate() and WEDeactivate() to prevent possible problems of activating or deactivating twice in a row without calling the other.
I had #pragma align commands to WASTE.h to make sure things were aligned properly when compiling for the PowerPC. Hopefully Marco will include these minor modifications in a future version of WASTE.
Acknowledgements
Thanks for Marco Piovanelli for writing WASTE and letting me see a C conversion of WASTE that was based on an older version of WASTE and not quite working.
Also, thanks to John Kendall for giving me a version of Marco's C port that he had gotten to work.
If you have any questions, or find any bugs, I can be contacted at: